package com.itheima.mapper;

import com.itheima.pojo.Emp;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface EmpMapper {

    @Select("select * from emp where username = #{username} and password = #{password}")
    Emp login(String username,String password);

    @Select("select count(*) from emp")
    Long count();

    @Select("select * from emp limit #{start},#{pageSize}")
    List<Emp> page(Integer start,Integer pageSize);

    void insert(Emp emp);

    @Select("select * from emp where phone = #{phone}")
    Emp findByPhone(String phone);

    void update(Emp emp);

    @Select("select * from emp where id = #{id}")
    Emp findById(Integer id);

    @Delete("delete from emp where id = #{id}")
    void delete(Integer id);

    void deletes(List<Integer> ids);

    @Delete("delete from emp where dept_id = #{id}")
    void deleteByDeptId(Integer id);

}
